<?xml version="1.0" encoding="iso-8859-1"?>

<!-- 
  -- Please see the readme.txt file included with this distribution for 
  -- attribution and copyright information.
  -->

<root version="2.0">
	<windowclass name="charsheet_skilllistitem">
		<sizelimits>
			<minimum>
				<height>18</height>
			</minimum>
		</sizelimits>
		<script file="scripts/charsheet_skilllistitem.lua" />
		<sheetdata>
			<windowreferencefield name="shortcut">
				<anchored>
					<right>
						<anchor>right</anchor>
						<offset>-2</offset>
					</right>
					<top>
						<anchor>top</anchor>
						<offset>2</offset>
					</top>
					<size>
						<width>20</width>
						<height>20</height>
					</size>
				</anchored>
				<icon>
					<normal>button_openwindow</normal>
					<empty>button_emptytarget</empty>
					<pressed>button_emptytarget</pressed>
				</icon>
				<allowdrop />
			</windowreferencefield>

			<linkednumber name="total">
				<anchored>
					<right>
						<parent>shortcut</parent>
						<anchor>left</anchor>
						<offset>-8</offset>
					</right>
					<top>
						<anchor>top</anchor>
						<offset>2</offset>
					</top>
					<size>
						<width>44</width>
					</size>
				</anchored>
				<frame>
					<name>modifier</name>
					<offset>5,5,5,5</offset>
				</frame>
				<font>sheetnumber</font>
				<readonly />
				<displaysign />
				<rollable />
				<hideonvalue>0</hideonvalue>
				<source>
					<name>stat</name>
					<op>+</op>
				</source>
				<source>
					<name>...encumbrance.armorcheckpenalty</name>
					<op>+</op>
				</source>
				<source>
					<name>...levelbonus</name>
					<op>+</op>
				</source>
				<source>
					<name>trained</name>
					<op>+</op>
				</source>
				<source>
					<name>misc</name>
					<op>+</op>
				</source>
				<script>
					function onSourceValue(source, sourcename)
						if sourcename == "trained" then
							if source.getValue() == 1 then
								return 5;
							end
							return 0;
						elseif sourcename == "...encumbrance.armorcheckpenalty" then
							if StringManager.contains({"strength", "dexterity", "constitution"}, window.statname.getStringValue()) then
								return math.min(source.getValue(), 0);
							end
							return 0;
						end

						return super.onSourceValue(source, sourcename);
					end

					function onDrag(button, x, y, draginfo)
						if dragging then
							return true;
						end
						
						local rActor, rSkill = CharSheetCommon.getSkillRollStructures(window.getDatabaseNode());
						local skill_name, skill_dice, skill_mod = RulesManager.buildSkillRoll(rActor, rSkill);
						dragging = RulesManager.dragAction(draginfo, "skill", skill_mod, skill_name, rActor, skill_dice);
						
						return true;
					end
					
					function onDragEnd(draginfo)
						dragging = false;
					end

					function onDoubleClick(x,y)	
						local rActor, rSkill = CharSheetCommon.getSkillRollStructures(window.getDatabaseNode());
						local skill_name, skill_dice, skill_mod = RulesManager.buildSkillRoll(rActor, rSkill);
						return RulesManager.dclkAction("skill", skill_mod, skill_name, rActor, nil, skill_dice);
					end
				</script>
			</linkednumber>
			<jpgnumberfield name="misc">
				<anchored>
					<to>total</to>
					<position>left</position>
					<offset>11,0</offset>
					<size>
						<width>32</width>
					</size>
				</anchored>
				<frame>
					<name>textline</name>
					<offset>0,-2,0,0</offset>
				</frame>
				<keyeditframe>
					<name>rowshade</name>
					<offset>1,1,1,1</offset>
				</keyeditframe>
				<stateframe>
					<drophilight>
						<name>rowshade</name>
						<offset>1,1,1,1</offset>
					</drophilight>
				</stateframe>
				<droptypes>
					<type>number</type>
				</droptypes>
				<font>sheetnumber</font>
				<hideonvalue>0</hideonvalue>
				<noreset />
				<nodrag />
				<displaysign />
			</jpgnumberfield>
			<checkbox name="trained">
				<anchored>
					<to>misc</to>
					<position>left</position>
					<offset>8,4</offset>
					<size>
						<width>32</width>
					</size>
				</anchored>
			</checkbox>
			<linkednumber name="level">
				<anchored>
					<to>misc</to>
					<position>left</position>
					<offset>48,0</offset>
					<size>
						<width>32</width>
					</size>
				</anchored>
				<frame>
					<name>textline</name>
					<offset>0,-2,0,0</offset>
				</frame>
				<displaysign />
				<hideonvalue>0</hideonvalue>
				<font>sheetnumber</font>
				<disabled />
				<source>
					<name>...levelbonus</name>
					<op>+</op>
				</source>
			</linkednumber>
			<numberfield name="stat">
				<anchored>
					<to>level</to>
					<position>left</position>
					<offset>8,0</offset>
					<size>
						<width>32</width>
					</size>
				</anchored>
				<frame>
					<name>textline</name>
					<offset>0,-2,0,0</offset>
				</frame>
				<displaysign />
				<hideonvalue>0</hideonvalue>
				<font>sheetnumber</font>
				<disabled />
				<script>
					function update(statname)
						setValue(NodeManager.get(window.getDatabaseNode(), "...abilities." .. statname .. ".bonus", 0));
					end
				</script>
			</numberfield>
			<labelcycler name="statname">
				<anchored>
					<right>
						<parent>stat</parent>
						<anchor>left</anchor>
						<offset>-8</offset>
					</right>
					<top>
						<anchor>top</anchor>
						<offset>5</offset>
					</top>
					<size>
						<width>40</width>
					</size>
				</anchored>
				<font>sheetlabel</font>
				<center />
				<stateframe>
					<hover>
						<name>sheetfocus</name>
						<offset>6,7,7,5</offset>
					</hover>
				</stateframe>
				<parameters>
					<labels>Str|Con|Dex|Int|Wis|Cha</labels>
					<values>strength|constitution|dexterity|intelligence|wisdom|charisma</values>
				</parameters>
				<script>
					function onValueChanged()
						window.onStatNameUpdate();
					end
				</script>
			</labelcycler>
			<genericcontrol name="armorwidget">
				<anchored>
					<right>
						<parent>statname</parent>
						<anchor>left</anchor>
					</right>
					<top>
						<anchor>top</anchor>
						<offset>7</offset>
					</top>
					<size>
						<height>9</height>
						<width>8</width>
					</size>
				</anchored>
			</genericcontrol>

			<checkbox name="showonminisheet">
				<anchored>
					<left>
						<anchor>left</anchor>
						<offset>6</offset>
					</left>
					<top>
						<anchor>top</anchor>
						<offset>8</offset>
					</top>
					<size>
						<width>12</width>
						<height>12</height>
					</size>
				</anchored>
				<checked />
			</checkbox>
			<checkbox name="classskill">
				<anchored>
					<to>showonminisheet</to>
					<position>right</position>
					<offset>4,0</offset>
					<size>
						<width>12</width>
					</size>
				</anchored>
			</checkbox>

			<stringfield name="label">
				<anchored>
					<left>
						<parent>classskill</parent>
						<anchor>right</anchor>
						<offset>6</offset>
					</left>
					<right>
						<parent>armorwidget</parent>
						<anchor>left</anchor>
						<offset>-8</offset>
					</right>
					<top>
						<anchor>top</anchor>
						<offset>5</offset>
					</top>
				</anchored>
				<font>sheettext</font>
				<frame>
					<name>textline</name>
				</frame>
			</stringfield>
		</sheetdata>
	</windowclass>

	<windowclass name="charsheet_skills">
		<placement>
			<size>
				<width>252</width>
				<height>611</height>
			</size>
		</placement>
		<nodelete />
		<sheetdata>
			<!-- NAME / RACE -->
			<genericcontrol name="overviewframe">
				<bounds>15,20,480,45</bounds>
				<frame>
					<name>sheetgroup</name>
				</frame>
			</genericcontrol>

			<labeledstring name="name">
				<anchored>
					<to>overviewframe</to>
					<position>insidetopleft</position>
					<offset>15,10</offset>
					<size>
						<width>250</width>
						<height>20</height>
					</size>
				</anchored>
				<label>name</label>
				<tabtarget>
					<next>race</next>
					<prev>notes</prev>
				</tabtarget>
			</labeledstring>

			<labeledstring name="race">
				<anchored>
					<to>overviewframe</to>
					<position>insidetopleft</position>
					<offset>275,10</offset>
					<size>
						<width>195</width>
						<height>20</height>
					</size>
				</anchored>
				<label>race</label>
				<tabtarget>
					<next>gender</next>
					<prev>name</prev>
				</tabtarget>
			</labeledstring>

			<!-- SKILLS -->
			<genericcontrol name="skillframe">
				<bounds>15,65,480,525</bounds>
				<frame>
					<name>sheetgroup</name>
				</frame>
			</genericcontrol>

			<genericcontrol>
				<anchored>
					<to>skillframe</to>
					<position>insidetopleft</position>
					<offset>15,9</offset>
					<size>
						<width>10</width>
						<height>10</height>
					</size>
				</anchored>
				<icon>indicator_quicklist</icon>
				<tooltip>
					<text>Show on Mini</text>
				</tooltip>
			</genericcontrol>
			<genericcontrol>
				<anchored>
					<to>skillframe</to>
					<position>insidetopleft</position>
					<offset>31,9</offset>
					<size>
						<width>10</width>
						<height>10</height>
					</size>
				</anchored>
				<icon>indicator_encumbrance</icon>
				<tooltip>
					<text>Class Skill</text>
				</tooltip>
			</genericcontrol>
			<stringcontrol>
				<anchored>
					<to>skillframe</to>
					<position>insidetopleft</position>
					<offset>50,9</offset>
				</anchored>
				<font>sheetlabelsmall</font>
				<static>Name</static>
			</stringcontrol>
			<stringcontrol>
				<anchored>
					<to>skillframe</to>
					<position>insidetopleft</position>
					<offset>242,9</offset>
				</anchored>
				<font>sheetlabelsmall</font>
				<static>Stat</static>
			</stringcontrol>
			<stringcontrol>
				<anchored>
					<to>skillframe</to>
					<position>insidetopleft</position>
					<offset>281,9</offset>
				</anchored>
				<font>sheetlabelsmall</font>
				<static>Level</static>
			</stringcontrol>
			<stringcontrol>
				<anchored>
					<to>skillframe</to>
					<position>insidetopleft</position>
					<offset>316,9</offset>
				</anchored>
				<font>sheetlabelsmall</font>
				<static>Trained</static>
			</stringcontrol>
			<stringcontrol>
				<anchored>
					<to>skillframe</to>
					<position>insidetopleft</position>
					<offset>362,9</offset>
				</anchored>
				<font>sheetlabelsmall</font>
				<static>Misc</static>
			</stringcontrol>
			<stringcontrol>
				<anchored>
					<to>skillframe</to>
					<position>insidetopleft</position>
					<offset>408,9</offset>
				</anchored>
				<font>sheetlabelsmall</font>
				<static>Total</static>
			</stringcontrol>

			<windowlist name="skilllist">
				<anchored>
					<to>skillframe</to>
					<position>over</position>
					<offset>-8,-25,-8,0</offset>
				</anchored>
				<datasource>.skilllist</datasource>
				<class>charsheet_skilllistitem</class>
				<allowcreate />
				<script file="scripts/charsheet_skilllist.lua" />
			</windowlist>
		</sheetdata>
	</windowclass>
</root>